package com.dongdongshop.service.impl.type_template;

import com.dongdongshop.mapper.TbTypeTemplateMapper;
import com.dongdongshop.pojo.type_template.TbTypeTemplate;
import com.dongdongshop.service.type_template.TypeTemPlateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@com.alibaba.dubbo.config.annotation.Service
public class TypeTemplateServiceImpl implements TypeTemPlateService {
    @Autowired
    private TbTypeTemplateMapper tbTypeTemplateMapper;
    @Override
    public List<TbTypeTemplate> listTypeTemplate() {
        return tbTypeTemplateMapper.selectByExample(null);
    }

    @Override
    @Transactional
    public int insertTypeTemplate(TbTypeTemplate tbTypeTemplate) {
        return tbTypeTemplateMapper.insertSelective(tbTypeTemplate);
    }

    @Override
    public TbTypeTemplate getTypeTemplate(Long id) {
        return tbTypeTemplateMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateTypeTemplate(TbTypeTemplate tbTypeTemplate) {
        return tbTypeTemplateMapper.updateByPrimaryKeySelective(tbTypeTemplate);
    }

    @Override
    public int deleteTypeTemplateBatch(Long[] ids) {
        return tbTypeTemplateMapper.deleteTypeTemplateBatch(ids);
    }
}
